package uk.co.cocking.getinline2.tagging;

import org.hamcrest.Matcher;

import uk.co.cocking.getinline2.record.Record;
import uk.co.cocking.getinline2.tagging.TaggingRule;

public class MatcherTagginRule implements TaggingRule {
	
	

	private final String[] tags;
	private final Matcher<Record> matcher;

	public MatcherTagginRule(Matcher<Record> matcher, String... tags) {
		this.tags = tags;
		this.matcher = matcher;
	}

	@Override
	public String[] getTagsFor(Record incomingRecord) {
		return matcher.matches(incomingRecord) ? tags : new String[0];
	}

}
